#!/bin/bash

if [ "$1" = "server" ]; then
    /usr/lib/rstudio-server/bin/rserver --server-daemonize=0 --auth-none=1
elif [ "$1" = "cmd" ]; then
    cd  /root/rstudio/data/input/
    Rscript /root/rstudio/data/input/main.r
else
    echo "Usage: $0 [server|cmd]"
    echo "  server: Start RStudio Server"
    echo "  cmd: one time run R script, run this script in the container,"/root/rstudio/data/input/main.r" "
    exit 1
fi